<?php

namespace Rbac\Controller;

/**
 * SchoolController
 * @author Jonas
 */
class SchoolController extends ExtendController {

    /**
     * 显示数据
     */
    public function index() {
        $modelName = $_GET["cmd"];
        $map = array();
        $filterFunction = "_filter" . $modelName;
        if (method_exists($this, $filterFunction)) {
            $map = $this->$filterFunction();
        }
        $model = D($modelName);
        $data = null;
        if (!empty($model)) {
            $data = $this->_list($model, $map);
        }

        if ($data["rows"] == null) {
            $data["rows"] = array();
        }
        $processFunction = "_process" . $modelName;
        if (method_exists($this, $processFunction)) {
            $data = $this->$processFunction($data);
        }
        //过滤数据
        $this->ajaxReturn($data);
    }
    
    
    /**
     * 专业数据过滤搜索
     * @return type
     */
    protected function _filterInfoDiscipline(){
        $map = array();
        if(!empty($_POST["id_name"])){
            $map["id_name"] = array("like","%".trim($_POST["id_name"])."%");
        }
        if(!empty($_POST["id_time"])){
            $map["id_time"] = $_POST["id_time"];
        }
        if(!empty($_POST["ico_id"])){
            $map["ico_id"] = $_POST["ico_id"];
        }
        return $map;
    }
    
    
    /**
     * 班级数据过滤搜索
     */
    protected function _filterInfoClass(){
        $map = array();
       
        if(!empty($_POST["id_id"])){
            $map["id_id"] = $_POST["id_id"];
        }
        if(!empty($_POST["ico_id"])){
            $map["ico_id"] = $_POST["ico_id"];
        }
        return $map;
    }

    /**
     * 班级信息
     */
    public function classInfo() {
        $this->display();
    }

    /**
     * 学部信息
     */
    public function college() {
        $this->display();
    }

    /**
     * 课程信息
     */
    public function curriculum() {
        $this->display();
    }

    /**
     * 班级信息
     */
    public function discipline() {
        $this->display();
    }

}
